package com.flycent.hqhs.ui;

import net.tsz.afinal.FinalActivity;
import net.tsz.afinal.annotation.view.ViewInject;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.RadioGroup;

import com.flycent.hqhs.R;

/**
 * 选择支付方式
 */
public class ChoicePayMethodActivity extends BackableTitleBarActivity{
	@ViewInject(id = R.id.pay_method_radioGroup) RadioGroup mRadioGroup;
	@ViewInject(id = R.id.pay_method_radio0,click = "butClick") RadioButton payRadio0;
	@ViewInject(id = R.id.pay_method_radio1,click = "butClick") RadioButton payRadio1;
	@ViewInject(id = R.id.pay_method_sure_but,click = "butClick") Button mSureBut;

	private String mPayMethodId;
	private String mPayIdStr = "0";

	@Override
	protected void onCreate(Bundle savedInstance) {
		super.onCreate(savedInstance);
		mPayMethodId = getIntent().getStringExtra("PayMethodId");

		setContentView(R.layout.activity_choicepaymethod);
		FinalActivity.initInjectedView(this);
		getTitleBar().setTitle(R.string.title_choise_pay_method);

		if("6".equals(mPayMethodId)){
			mRadioGroup.check(R.id.pay_method_radio0);
		}else if("2".equals(mPayMethodId)){
			mRadioGroup.check(R.id.pay_method_radio1);
		}


	}
	public void butClick(View v){
		//银联
		if(v == payRadio0){
			mPayIdStr = "6";
		}
		//支付宝
		if(v == payRadio1){
			mPayIdStr = "2";
		}
		//确认
		if(v == mSureBut){
			Intent intent = new Intent();
			intent.putExtra("mPayId", mPayIdStr);
			setResult(200,intent);
			finish();

		}
	}

}
